{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 最值归一化 Normallization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x = np.random.randint(0, 100, size=100) # 100个0~100的随机整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([13, 53, 69, 55, 99, 10, 70, 30, 26, 92,  2, 73, 31, 53, 63, 46, 93,\n",
       "       96, 55,  9, 79, 44, 21,  2, 34, 51, 30, 75, 16, 12, 56, 82, 95, 86,\n",
       "       37, 83, 78, 69, 25, 36, 65, 61, 55, 70, 67, 42, 24, 50, 32, 93, 97,\n",
       "       32, 35, 42, 46, 69, 84, 36, 50, 56, 19, 23, 61, 89, 41, 78, 68, 78,\n",
       "       25, 38, 73, 40, 11, 85, 67, 88, 71, 13, 64, 92, 96, 39, 66, 85, 82,\n",
       "       19, 83, 98, 41, 70, 45, 26, 44, 24, 95, 93, 44, 73, 31,  9])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.11340206,  0.5257732 ,  0.69072165,  0.54639175,  1.        ,\n",
       "        0.08247423,  0.70103093,  0.28865979,  0.24742268,  0.92783505,\n",
       "        0.        ,  0.73195876,  0.29896907,  0.5257732 ,  0.62886598,\n",
       "        0.45360825,  0.93814433,  0.96907216,  0.54639175,  0.07216495,\n",
       "        0.79381443,  0.43298969,  0.19587629,  0.        ,  0.32989691,\n",
       "        0.50515464,  0.28865979,  0.75257732,  0.1443299 ,  0.10309278,\n",
       "        0.55670103,  0.82474227,  0.95876289,  0.86597938,  0.36082474,\n",
       "        0.83505155,  0.78350515,  0.69072165,  0.2371134 ,  0.35051546,\n",
       "        0.64948454,  0.60824742,  0.54639175,  0.70103093,  0.67010309,\n",
       "        0.41237113,  0.22680412,  0.49484536,  0.30927835,  0.93814433,\n",
       "        0.97938144,  0.30927835,  0.34020619,  0.41237113,  0.45360825,\n",
       "        0.69072165,  0.84536082,  0.35051546,  0.49484536,  0.55670103,\n",
       "        0.17525773,  0.21649485,  0.60824742,  0.89690722,  0.40206186,\n",
       "        0.78350515,  0.68041237,  0.78350515,  0.2371134 ,  0.37113402,\n",
       "        0.73195876,  0.39175258,  0.09278351,  0.8556701 ,  0.67010309,\n",
       "        0.88659794,  0.71134021,  0.11340206,  0.63917526,  0.92783505,\n",
       "        0.96907216,  0.3814433 ,  0.65979381,  0.8556701 ,  0.82474227,\n",
       "        0.17525773,  0.83505155,  0.98969072,  0.40206186,  0.70103093,\n",
       "        0.44329897,  0.24742268,  0.43298969,  0.22680412,  0.95876289,\n",
       "        0.93814433,  0.43298969,  0.73195876,  0.29896907,  0.07216495])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(x - np.min(x)) / (np.max(x) - np.min(x)) # 将x的所有元素都进行了归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X= np.random.randint(0, 100, (50, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[66, 83],\n",
       "       [53, 14],\n",
       "       [87, 33],\n",
       "       [21, 67],\n",
       "       [62, 16],\n",
       "       [74, 19],\n",
       "       [90, 78],\n",
       "       [ 1, 36],\n",
       "       [59, 40],\n",
       "       [82,  6],\n",
       "       [87, 93],\n",
       "       [72, 40],\n",
       "       [95, 79],\n",
       "       [ 8, 87],\n",
       "       [27, 16],\n",
       "       [52, 88],\n",
       "       [33, 23],\n",
       "       [64,  5],\n",
       "       [47, 99],\n",
       "       [54, 64],\n",
       "       [71, 17],\n",
       "       [22, 11],\n",
       "       [13, 13],\n",
       "       [34, 84],\n",
       "       [27, 92],\n",
       "       [63, 42],\n",
       "       [77, 40],\n",
       "       [90, 15],\n",
       "       [57, 74],\n",
       "       [85, 95],\n",
       "       [ 0, 79],\n",
       "       [27,  3],\n",
       "       [37, 58],\n",
       "       [57, 54],\n",
       "       [30,  2],\n",
       "       [44, 71],\n",
       "       [33, 62],\n",
       "       [13, 74],\n",
       "       [59, 71],\n",
       "       [54, 18],\n",
       "       [93, 98],\n",
       "       [69, 53],\n",
       "       [87, 83],\n",
       "       [ 9,  2],\n",
       "       [41, 89],\n",
       "       [75, 35],\n",
       "       [ 0, 14],\n",
       "       [81, 51],\n",
       "       [41, 68],\n",
       "       [99, 83]])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[66, 83],\n",
       "       [53, 14],\n",
       "       [87, 33],\n",
       "       [21, 67],\n",
       "       [62, 16],\n",
       "       [74, 19],\n",
       "       [90, 78],\n",
       "       [ 1, 36],\n",
       "       [59, 40],\n",
       "       [82,  6]])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[:10, :] # 取出x的前10行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X = np.array(X, dtype=float) # 因为要归一化到0~1，所以数据类型要转换到浮点型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X[:, 0] = (X[:, 0] - np.min(X[:, 0])) / (np.max(X[:, 0]) - np.min(X[:, 0])) # 第一列归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X[:, 1] = (X[:, 1] - np.min(X[:, 1])) / (np.max(X[:, 1]) - np.min(X[:, 1])) # 第二列归一化。n列的话注意要循环一下"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.66666667,  0.83505155],\n",
       "       [ 0.53535354,  0.12371134],\n",
       "       [ 0.87878788,  0.31958763],\n",
       "       [ 0.21212121,  0.67010309],\n",
       "       [ 0.62626263,  0.1443299 ],\n",
       "       [ 0.74747475,  0.17525773],\n",
       "       [ 0.90909091,  0.78350515],\n",
       "       [ 0.01010101,  0.35051546],\n",
       "       [ 0.5959596 ,  0.39175258],\n",
       "       [ 0.82828283,  0.04123711],\n",
       "       [ 0.87878788,  0.93814433],\n",
       "       [ 0.72727273,  0.39175258],\n",
       "       [ 0.95959596,  0.79381443],\n",
       "       [ 0.08080808,  0.87628866],\n",
       "       [ 0.27272727,  0.1443299 ],\n",
       "       [ 0.52525253,  0.88659794],\n",
       "       [ 0.33333333,  0.21649485],\n",
       "       [ 0.64646465,  0.03092784],\n",
       "       [ 0.47474747,  1.        ],\n",
       "       [ 0.54545455,  0.63917526],\n",
       "       [ 0.71717172,  0.15463918],\n",
       "       [ 0.22222222,  0.09278351],\n",
       "       [ 0.13131313,  0.11340206],\n",
       "       [ 0.34343434,  0.84536082],\n",
       "       [ 0.27272727,  0.92783505],\n",
       "       [ 0.63636364,  0.41237113],\n",
       "       [ 0.77777778,  0.39175258],\n",
       "       [ 0.90909091,  0.13402062],\n",
       "       [ 0.57575758,  0.74226804],\n",
       "       [ 0.85858586,  0.95876289],\n",
       "       [ 0.        ,  0.79381443],\n",
       "       [ 0.27272727,  0.01030928],\n",
       "       [ 0.37373737,  0.57731959],\n",
       "       [ 0.57575758,  0.53608247],\n",
       "       [ 0.3030303 ,  0.        ],\n",
       "       [ 0.44444444,  0.71134021],\n",
       "       [ 0.33333333,  0.6185567 ],\n",
       "       [ 0.13131313,  0.74226804],\n",
       "       [ 0.5959596 ,  0.71134021],\n",
       "       [ 0.54545455,  0.16494845],\n",
       "       [ 0.93939394,  0.98969072],\n",
       "       [ 0.6969697 ,  0.5257732 ],\n",
       "       [ 0.87878788,  0.83505155],\n",
       "       [ 0.09090909,  0.        ],\n",
       "       [ 0.41414141,  0.89690722],\n",
       "       [ 0.75757576,  0.34020619],\n",
       "       [ 0.        ,  0.12371134],\n",
       "       [ 0.81818182,  0.50515464],\n",
       "       [ 0.41414141,  0.68041237],\n",
       "       [ 1.        ,  0.83505155]])"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFSxJREFUeJzt3X+MXedZ4PHvs04iDaJ0KmLYehKvvavgEhS6KdOkItXS\nHwInQcIh6mqTIiIiJMuCIMQfUQx/wB/VKkb5p1RpG1lVhPoPoYLIGNWQRQToqiVLxnKbNAmuTCoa\nTyo1bUmRWkvB5OGPuV6PpzO+53rOPee87/l+JCu+976Z+7y6dx6/5znPe05kJpKkuvynvgOQJLXP\n5C5JFTK5S1KFTO6SVCGTuyRVyOQuSRUyuUtShUzuklQhk7skVeiqvt742muvzT179vT19pJUpJMn\nT34zM3dOG9dbct+zZw8rKyt9vb0kFSki/rnJOMsyklQhk7skVcjkLkkVMrlLUoVM7pJUIZO7JFXI\n5C5JFZqa3CPi8Yj4RkR8eYvXIyI+FhFnIuK5iHhX+2FKkmbRZBPTHwKPAp/e4vU7gBsm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P/BF4APAfwP+KiL+b2b+a79h\nla2U5L4KXL/u8XWT52YdU4pGc4mInwQ+BdyRmd/qKLa2NZnrMvDEJLFfC9wZEecz81g3IbaqyXzP\nAt/KzO8C342IzwHvBEpM7k3mez9wJNeK0mci4qvAO4B/6CbETnWWp0opyzwL3BAReyPiGuAe4PiG\nMceB+yZno98DfCczv951oC2ZOt+I2A08Cfxy4Su6qXPNzL2ZuScz9wB/AvxaoYkdmn2X/wx4b0Rc\nFRE/ANwKvNRxnG1pMt+vsXaUQkT8KLAPeLnTKLvTWZ4qYuWemecj4gHgKdbOvj+emS9ExKHJ64+x\n1kVxJ3AG+B5rq4EiNZzv7wI/DHxisqI9nwVehKnhXKvRZL6Z+VJE/CXwHPAm8KnM3LS1bugafr4f\nAf4wIp5nrYvkocws8mqREfFHwPuAayPiLPB7wNXQfZ5yh6okVaiUsowkaQYmd0mqkMldkipkcpek\nCpncJalCJndJqpDJXZIqZHKXpAr9B+PrYNw/7we2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10ac227f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[:, 0], X[:, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.52969696969696967"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(X[:, 0]) # 接近0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.28277892787258835"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(X[:, 0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.50247422680412379"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(X[:, 1]) # 接近0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.32368382573986398"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(X[:, 1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 均值方差归一化 Standardization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X2 = np.random.randint(0, 100, (50, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X2 = np.array(X2, dtype=float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "X2[:, 0] = (X2[:, 0] - np.mean(X2[:, 0])) / np.std(X2[:, 0])  # 第一列的均值方差归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X2[:, 1] = (X2[:, 1] - np.mean(X2[:, 1])) / np.std(X2[:, 1])  # 第二列的均值方差归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFdhJREFUeJzt3WuMXHd5x/HfD2OkLaLdpjZxvMliI1luIREYjQyNURVo\nwMFCsrEISnhBWiGt3JKXtbQoEpWQqrjlTaGkgIsiwosmRSp2LOJgxbhVaNTQrHEuNomL6yaKJyE2\nAQciVsVJnr6Ys/F4M5cze87OuX0/0sgzZ47n/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H7f9viLK2U+K8l9n+6XkfD9q+wtF\nlLMf23faPmv7eJ/ny37+h5W/1Od/JBFRypukP5K0UdK/S2oN2O9pSauKLu9Syi9phaT/kfROSW+R\n9JikdxVd9q7y/Z2k2eT+rKS/Lft7kOacqnO96vslWdIHJP2o6HKPWP7rJH2v6LIO+Bv+RNL7JB3v\n83xpz3/K8pf6/I9yK20LICKejIiTRZdjqVKWf7OkUxFxOiJ+K+keSduXv3SpbZd0V3L/Lkk7CixL\nWmnO6XZJ346OhyVN2r5i3AXto+yfiaEi4kFJvxiwS5nPf5ry10ZpA8AIQtJh20dtzxRdmBFNSXq2\n6/GZZFtZXB4Rzyf3fybp8j77lek9SHNOy3ze05bt2qT75H7b7x5P0XJT5vOfVpXP/+sKvSKY7cOS\n1vR46raIuDfly3wwItq23y7pAdtPJRF82eVU/kIN+hu6H0RE2O43Zayw96ChfixpOiJetr1N0n5J\nGwouU5PU5vwXGgAi4vocXqOd/HvW9j51mtBj+fHJofxtSVd1Pb4y2TY2g/4G2y/YviIink+a6Gf7\nvEZh70EPac5p4ed9gKFli4hfdd0/aPsfba+KiLLnqFlQ5vM/VA3O/+sq3QVk+62237ZwX9JHJfUc\nuS+pRyRtsL3e9lsk3STpQMFl6nZA0i3J/VskvaFVU8L3IM05PSDpM8lslA9Ieqmrq6toQ8tve41t\nJ/c3q/M9fnHsJV26Mp//oWpw/i8qehS6303SJ9TpG/w/SS9IOpRsXyvpYHL/nerMknhM0gl1ul4K\nL3va8iePt0n6b3VmfpSm/EnZ/kDSDyT9VNJhSZdV4T3odU4l7ZK0K7lvSXckzz+hAbPMSlr+W5Nz\n/ZikhyVdW3SZF5X/bknPS7qQfAc+W7HzP6z8pT7/o9xYCQwADVXpLiAAwNIRAACgoQgAANBQBAAA\naCgCAAA0FAEAABqKAAAADUUAAICG+n9kf9+HQRN5DAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10e276e48>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X2[:, 0], X2[:, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6.661338147750939e-17"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(X2[:, 0]) # 无限逼近0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(X2[:, 0]) # 无限逼近1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.4408920985006263e-18"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(X2[:, 1]) # 无限逼近0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(X2[:, 1]) # 无限逼近1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
